package com.liuxing.doctor.service.impl;

import com.liuxing.doctor.entity.Prescription;
import com.liuxing.doctor.mapper.PrescriptionMapper;
import com.liuxing.doctor.service.PrescriptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 行柳
 * 学习使用
 */
@Service
@Slf4j
public class PrescriptionServiceImpl implements PrescriptionService {
    @Resource
    private PrescriptionMapper prescriptionMapper;
    @Override
    public List<Prescription> queryPrescriptionsByPatientId(String patient_id) {
        return prescriptionMapper.selectPrescriptionsByPatientId(patient_id);
    }

    @Override
    public int createNullPrescriptionByPatientId(Map<String, Object> map) {
        return prescriptionMapper.insertNullPrescriptionByPatientId(map);
    }

    @Override
    public int deletePrescriptionsByPatientId(String patient_id) {
        return prescriptionMapper.deletePrescriptionsByPatientId(patient_id);
    }

    @Override
    public int updatePatientPrescription(Map<String, Object> map) {
        return prescriptionMapper.updatePatientPrescription(map);
    }

    @Override
    public int createPrescriptionByPatient(Map<String, Object> map) {
        return prescriptionMapper.insertPrescriptionByPatient(map);
    }

    @Override
    public int insertPrescription (Prescription prescription) {
        return prescriptionMapper.insertPrescription(prescription);
    }
}
